#!/usr/bin/bash
#
# Install docker-compose-linux-x86_64 into VM
#
# To download the latest docker-compose, please visit:
# * https://github.com/docker/compose/releases/tag/v2.30.3
#

docker_compose=${1:-"/var/tmp/docker-compose-linux-x86_64"}
docker_compose_filename=$(basename $docker_compose)
sudo mkdir -p /usr/libexec/docker/cli-plugins
sudo cp ${docker_compose} /usr/libexec/docker/cli-plugins/${docker_compose_filename}
sudo chmod +x /usr/libexec/docker/cli-plugins/${docker_compose_filename}
pushd $(pwd -P) > /dev/null 2>&1
cd /usr/libexec/docker/cli-plugins
sudo ln -s ${docker_compose_filename} docker-compose
popd > /dev/null 2>&1
sudo ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/sbin/docker-compose
